package sctu.edu.java.year2016.team01.xuhanmei.day20160611;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * Created by Administrator on 2016/6/12...
 */
public class TCPServer {
    public static void main(String[] args) throws IOException {
        ServerSocket ss=new ServerSocket(6666);//创建绑定到特定端口的服务器套接字
        while(true){
            Socket s=ss.accept();//
            System.out.println("一个新的连接已经建立好了！");
            DataInputStream dis=new DataInputStream(s.getInputStream());
            System.out.println(dis.readUTF());
            dis.close();
            s.close();
        }
    }
}
